package org.mango.service.impl;

import org.mango.bean.Grid;
import org.mango.mapper.GridMapper;
import org.mango.service.GridService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * Created by meigang on 17/10/14.
 */
@Service
@Transactional
public class GridServiceImpl implements GridService {
    @Autowired
    GridMapper mapper;

    @Override
    public List<Grid> list(Map<String, Object> map) {
        return mapper.selectAll(map);
    }

    @Override
    public void add(Grid obj) {
        mapper.insert(obj);
    }

    @Override
    public Grid getById(String id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public void update(Grid obj) {
        mapper.updateByPrimaryKey(obj);
    }

    @Override
    public void delete(String id) {
        mapper.deleteByPrimaryKey(id);
    }

    @Override
    public void updateShow(Grid grid) {
        mapper.updateShow(grid);
    }

    @Override
    public List<Grid> listRandom(Map<String, Object> map) {
        return mapper.listRandom(map);
    }
}
